//
//  UIBarButtonItem+XMGExtension.m
//  6期-百思不得姐
//
//  Created by xiaomage on 15/12/4.
//  Copyright © 2015年 xiaomage. All rights reserved.
//

#import "UIBarButtonItem+XMGExtension.h"

@implementation UIBarButtonItem (XMGExtension)

+ (instancetype)xmg_itemWithImage:(NSString *)title highTitle:(NSString *)highTitle target:(id)target action:(SEL)action{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
//    [button setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
      button.titleLabel.font=[UIFont systemFontOfSize:15.0];
      [button setTitle:title  forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [button sizeToFit];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[self alloc] initWithCustomView:button];
}


+ (instancetype)xmg_itemWithImage:(NSString *)title highImage:(UIImage *)highImage img:(UIImage *)image target:(id)target action:(SEL)action{
    
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    //    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    //    [button setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
    button.titleLabel.font=[UIFont systemFontOfSize:12.0];
    [button setTitle:title  forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [button sizeToFit];
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[self alloc] initWithCustomView:button];
}

@end
